package DFS;

import java.util.*;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2024-03-28
 * Time:9:19
 * Text：混境之地
 */
public class Text12 {
        static int N = 1010;
        static int n, m;
        static int A, B, C, D;
        static char[][] arr = new char[N][N];
        static int[][] color = new int[N][N];
        static int[] dx = { 1, -1, 0, 0 };
        static int[] dy = { 0, 0, -1, 1 };

        static void dfs(int x, int y, int c) {
            color[x][y] = c;
            for (int i = 0; i < 4; i++) {
                int xx = x + dx[i];
                int yy = y + dy[i];
                // 剪枝
                if (xx < 0 || xx >= n || yy < 0 || yy >= m || color[xx][yy] != 0 || arr[xx][yy] == '#') {
                    continue;
                }
                dfs(xx, yy, c);
            }

        }

        public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            n = scan.nextInt();
            m = scan.nextInt();
            A = scan.nextInt() - 1;
            B = scan.nextInt() - 1;
            C = scan.nextInt() - 1;
            D = scan.nextInt() - 1;

            for (int i = 0; i < n; ++i) {
                arr[i] = scan.next().toCharArray();
            }
            // 类比成染色
            dfs(A, B, 1);

            if (color[C][D] == 1) {
                System.out.println("Yes");
                return;
            }
            // 将后半部分染色
            dfs(C, D, 2);

            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < m; ++j) {
                    if (arr[i][j] == '#' && check(i, j)) {
                        System.out.println("Yes");
                        return;
                    }
                }
            }

            System.out.println("No");
        }

        static boolean check(int x, int y) {
            int u = 0;
            for (int i = 0; i < 4; ++i) {
                int tx = x + dx[i], ty = y + dy[i];
                if (tx < 0 || ty < 0 || tx >= n || ty >= m) {
                    continue;
                }
                u |= color[tx][ty];
            }
            return u == 3;
        }

    }